/*	Copyright 2007 - Xavier Baro (xbaro@cvc.uab.cat)

	This file is part of eapmlib.

    Eapmlib is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or any 
	later version.

    Eapmlib is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __UNIVARIATEPROBMODEL_H__
#define __UNIVARIATEPROBMODEL_H__

#include "EvolutiveLib.h"
#include "ProbModel.h"

namespace Evolutive {

	class EVOLUTIVELIB_API CUnivariateProbModel : public CProbModel
	{
		//! Methods
	public:
		//! Default constructor		
		CUnivariateProbModel(void);

		//! Default destructor
		virtual ~CUnivariateProbModel(void);

		//! Indicates when the model is at a standstill(from base class)
		virtual bool IsStatic(double Tolerance);

		//! Generates a new population using the probability distribution(from base class)
		virtual void NewPopulation(CPopulation &Population,CODING_METHOD ModelCode,CEvaluator *Evaluator);

		//! Updates the model using an individual (from base class)
		virtual void Update(CChromosome &C);

		//! Estimate a model from the data (from base class)
		virtual void Estimate(int NumIndividuals,CPopulation &Population);	

		//! Initialize the probability model (from base class)
		virtual void InitializeModel(int NumVars,CPopulation &Population);

		//! Sets the learning rate
		void SetLR(double LR);
		
	private:
					
		//! Attributes
	private:

		//! Probability distribution
		double *m_ProbDist;

		//! Learning rate
		double m_LR;
	};	
}

#endif // __UNIVARIATEPROBMODEL_H__
